﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Helpers.AmazonUtils
{
    public class HostDefine
    {
        public enum From
        {
            us,
            jp,
            uk,
            de,
            cn,
            br,
            mx,
            es,
            it,
            in_,
            ca,
            fr,
        }
        public class Info
        {
            public From From { get; set; }
            public string Host { get; set; }
            public string MarketplaceID { get; set; }
        }
        public static Dictionary<From, Info> infos = new Dictionary<From, Info> {
            { From.us,new Info{
                From = From.us,
                Host ="www.amazon.com",
                MarketplaceID="ATVPDKIKX0DER",
            } },
            { From.uk,new Info{
                From = From.uk,
                Host ="www.amazon.co.uk",
                MarketplaceID="A1F83G8C2ARO7P",
            } },
            { From.de,new Info{
                From = From.de,
                Host ="www.amazon.de",
                MarketplaceID="A1PA6795UKMFR9",
            } },
            { From.fr,new Info{
                From = From.fr,
                Host ="www.amazon.fr",
                MarketplaceID="A13V1IB3VIYZZH",
            } },
            { From.ca,new Info{
                From = From.ca,
                Host ="www.amazon.ca",
                MarketplaceID="A2EUQ1WTGCTBG2",
            } },
            { From.jp,new Info{
                From = From.jp,
                Host ="www.amazon.co.jp",
                MarketplaceID="A1VC38T7YXB528",
            } },
            { From.in_,new Info{
                From = From.in_,
                Host ="www.amazon.in",
                MarketplaceID="A21TJRUUN4KGV",
            } },
            { From.it,new Info{
                From = From.it,
                Host ="www.amazon.it",
                MarketplaceID="APJ6JRA9NG5V4",
            } },
            { From.es,new Info{
                From = From.es,
                Host ="www.amazon.es",
                MarketplaceID="A1RKKUPIHCS9HS",
            } },
            { From.mx,new Info{
                From = From.mx,
                Host ="www.amazon.com.mx",
                MarketplaceID="A1AM78C64UM0Y8",
            } },
            { From.br,new Info{
                From = From.br,
                Host ="www.amazon.com.br",
                MarketplaceID="A2Q3Y263D00KWC",
            } },
            { From.cn,new Info{
                From = From.cn,
                Host ="www.amazon.cn",
                MarketplaceID="AAHKV2X7AFYLW",
            } },
        };

        public static Info GetInfo(string from)
        {
            from = from.ToLower();
            return infos[(From)Enum.Parse(typeof(From), from)];
        }
    }
}
